package com.tping.design.singleton;

/**
 * @author xiai
 * @Date 2023/2/8 12:45
 * @Version 1.0
 */
public class SingletonTypeThreadSafe {

    private static volatile SingletonTypeThreadSafe instance;
    private SingletonTypeThreadSafe (){}
    public static SingletonTypeThreadSafe getInstance(){
        if( instance == null ){
            synchronized(SingletonTypeThreadSafe.class){
                if( instance == null ){
                    instance = new SingletonTypeThreadSafe();
                }
            }
        }
        return instance;
    }
}
